/*
 * @Author: wangze@linkstec.com
 * @Date: 2022-03-04 10:57:46
 * @Function: Please Input Function
 */
import Vue from 'vue';
import store from '@/store';
import VueI18n from 'vue-i18n';
import elEn from 'element-ui/lib/locale/lang/en';
import elZh from 'element-ui/lib/locale/lang/zh-CN';
import en from './en';
import zh from './zh';

Vue.use(VueI18n);

const messages = {
  en: {
    ...en,
    ...elEn
  },
  zh: {
    ...zh,
    ...elZh
  }
};

function getLanguage () {
  return store.getters['system/language'] || 'zh';
}

const i18n = new VueI18n({
  locale: getLanguage(),
  messages,
  // 隐藏警告
  silentTranslationWarn: true
});

export default i18n;
